﻿using System;

namespace RemoteImaging.LicensePlate
{
    public class ReportedCarInfo : DevExpress.Xpo.XPObject
    {
        public ReportedCarInfo()
            : base()
        {
        }

        public ReportedCarInfo(DevExpress.Xpo.Session session)
            : base(session)
        {

        }



        private string _caseNumber;
        public string CaseNumber
        {
            get { return _caseNumber; }
            set { SetPropertyValue("CaseNumber", ref _caseNumber, value); }
        }

        private string _licenseNumber;
        public string LicenseNumber
        {
            get { return _licenseNumber; }
            set
            {
                SetPropertyValue("LicenseNumber", ref _licenseNumber, value);
                //System.Diagnostics.Debug.WriteLine(Oid);
            }
        }

        private string _carFrameNumber;
        public string CarFrameNumber
        {
            get { return _carFrameNumber; }
            set { SetPropertyValue("CarFrameNumber", ref _carFrameNumber, value); }
        }

        private string _engineNumber;
        public string EngineNumber
        {
            get { return _engineNumber; }
            set { SetPropertyValue("EngineNumber", ref _engineNumber, value); }
        }

        private string _color;
        public string Color
        {
            get { return _color; }
            set { SetPropertyValue("Color", ref _color, value); }
        }

        private string _carType;
        public string CarType
        {
            get { return _carType; }
            set { SetPropertyValue("CarType", ref _carType, value); }
        }

        private DateTime _creationTime;
        public DateTime CreationTime
        {
            get { return _creationTime; }
            set { SetPropertyValue("CreationTime", ref _creationTime, value); }
        }

        private DateTime _updateTime;
        public DateTime UpdateTime
        {
            get { return _updateTime; }
            set { SetPropertyValue("UpdateTime", ref _updateTime, value); }
        }

        private string _url;
        public string Url
        {
            get { return _url; }
            set { SetPropertyValue("Url", ref _url, value); }
        }

        public void CopyFrom(SuspectCarInfoDto x)
        {
            if (x == null) throw new ArgumentNullException("x");

            this.CarFrameNumber = x.CarFrameNumber;
            this.CarType = x.CarType;
            this.CaseNumber = x.CaseNumber;
            this.Color = x.Color;
            this.EngineNumber = x.EngineNumber;
            this.LicenseNumber = x.LicenseNumber;
            this.Url = x.Url;
        }

        protected override void OnSaving()
        {
            base.OnSaving();
            this.UpdateTime = DateTime.Now;
        }

        public override void AfterConstruction()
        {
            base.AfterConstruction();
            //System.Diagnostics.Debug.WriteLine(Oid);
        }
    }


}